﻿@*@model IEnumerable<SGIMail.Models.EventViewModel>*@
@model PagedList.IPagedList<SGIMail.Models.EventViewModel>
@using PagedList.Mvc;
<link href="~/Content/PagedList.css" rel="stylesheet" type="text/css" />
@{
    ViewBag.Title = "Events";
}

<h2>Events</h2>


<p>
    @Html.ActionLink("Create New", "Create")
</p>
@using (Html.BeginForm("Index","Event", FormMethod.Get))
{
    <p>
        Find by Name/Theme: @Html.TextBox("searchString", ViewBag.CurrentFilter as string)
        <input type="submit" value="Search" />
    </p>
}


<table class="table">
    <tr>
        <th>
            @Html.ActionLink("Name", "Index", new { sortOrder = ViewBag.EventNameSortParm, currentFilter = ViewBag.CurrentFilter })
            @*@Html.DisplayNameFor(model => model.Name)*@
        </th>
        <th>
            @Html.ActionLink("Theme", "Index", new { sortOrder = ViewBag.EventThemeSortParm, currentFilter = ViewBag.CurrentFilter })
            @*@Html.DisplayNameFor(model => model.Theme)*@
        </th>
        <th>
            @Html.ActionLink("Date", "Index", new { sortOrder = ViewBag.DateSortParm, currentFilter = ViewBag.CurrentFilter })
            @*@Html.DisplayNameFor(model => model.Date)*@
        </th>
       
        <th>
           <center>Registered / Invited</center>
        </th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Theme)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Date)
        </td>
     <td>
         <center>@Html.DisplayFor(modelItem => item.participation)</center>
        
     </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.id }) |
            @Html.ActionLink("Details", "Details", new { id=item.id }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.id })
            
        </td>
    </tr>
}

</table>
<br />
Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount

@Html.PagedListPager(Model, page => Url.Action("Index",
    new { page, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter }))